﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using Sinacor.Servico.Bovespa.Custodia.Service.ServiceContract;
using System.ComponentModel;
using Sinacor.Servico.Bovespa.Cliente.BusinessEntity;
using Sinacor.Infra.Service.Security.Services;

namespace Sinacor.Servico.Bovespa.Custodia.Service.ServiceImplementation
{

    [SinacorServiceBehavior]
    public class Custodia : ServiceContract.ICustodia
    {
        /// <summary>
        /// Historico:
        /// Data : 19/12/2007
        /// Autor: Ludmilla Modesto 
        /// Obs.: Criado. Metodo que retorna a posicao do cliente na custodia
        /// </summary>
        /// <returns></returns>
        ///[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public DataContract.Response.PosicaoCustodiaResponse
            ConsultarPosicaoCustodia(DataContract.Request.ConsultarPosicaoCustodiaRequest request)
        {

            Sinacor.Servico.Bovespa.Cliente.BusinessEntity.Cliente beCliente =
                Sinacor.Servico.Bovespa.Custodia.Service.ServiceImplementation.Translator.TranslateBetweenClienteAndConsultarPosicaoCustodiaRequest.
                TranslateConsultarPosicaoCustodiaRequestToCliente(request);

            Sinacor.Servico.Bovespa.Custodia.BusinessLogic.Custodia blCustodia = new Sinacor.Servico.Bovespa.Custodia.BusinessLogic.Custodia();

            BusinessEntity.PosicaoCustodia custodia =
                blCustodia.ConsultarPosicaoCustodia(beCliente,request.Ativos, request.Carteira);

            return
                Sinacor.Servico.Bovespa.Custodia.Service.ServiceImplementation.Translator.TranslateBetweenPosicaoCustodiaResponseAndPosicaoCustodia.
                TranslatePosicaoCustodiaToPosicaoCustodiaResponse(custodia);
        }



    }
}
